/*
 * @Descripttion:
 * @Author: lukasavage
 * @Date: 2021-11-10 21:10:26
 * @LastEditors: lukasavage
 * @LastEditTime: 2021-12-27 23:43:54
 */
// import React from 'react'
// import ReactDOM from 'react-dom'
// import { HashRouter as Router, Link, NavLink } from './react-router-dom'
// import { Redirect, Route, Switch } from './react-router'
// import {  } from './react-router-dom'
// import Home from './pages/Home';
// import Abort from './pages/Abort';
// import Index from './pages/Index';
// import store from './store'
// import { Provider } from './react-redux'
// import ReduxDemo from './pages/ReduxDemo'

// reactDOM.render((
//     <Provider store={store}>
//         <Router>
//             <ul>
//                 <li><NavLink to="/" exact activeStyle={{ color: '#f90' }}>首页</NavLink></li>
//                 <li><NavLink to="/home" exact activeStyle={{ color: '#f90' }}>用户</NavLink></li>
//                 <li><NavLink to="/abort" exact activeStyle={{ color: '#f90' }}>关于</NavLink></li>
//             </ul>
//             <Switch>
//                 <Route path="/" exact component={Index}></Route>
//                 <Route path="/home" exact component={Home}></Route>
//                 <Route path="/abort" exact component={Abort}></Route>
//                 <Redirect to="/home" />
//             </Switch>
//         </Router>
//         <ReduxDemo></ReduxDemo>
//     </Provider>
// ), document.getElementById('root'));

import React from './react/react';
import ReactDOM from './react/react-dom4';
import { updateQueue } from './react/component2';

// function App(props) {
//     // console.log(Component);
// 	return (
// 		<h1 style={{ color: 'red' }} id='title' className='hehe'>
// 			我是你爸爸
// 			<span>{props.name}</span>
// 		</h1>
// 	);
// }

class App extends React.Component {
	state = {
		num: 0,
	};
	handleClick = e => {
		e.stopPropagation();
        console.log(e.stopPropagation);
		// updateQueue.isBatchingUpdate = true;
		// this.setState({ num: this.state.num + 1 });
		this.setState(state => ({ num: state.num + 1 }));
		console.log(this.state.num);
		this.setState(state => ({ num: state.num + 1 }));
		console.log(this.state.num);
		setTimeout(() => {
			this.setState(state => ({ num: state.num + 1 }));
			console.log(this.state.num);
			this.setState(state => ({ num: state.num + 1 }));
			console.log(this.state.num);
		});
		// updateQueue.batchUpdate();
	};
	handleDivClick = () => {
		console.log('点了div的事件了');
	};
	render() {
		return (
			<div style={{ background: '#ccc' }} onClick={this.handleDivClick}>
				<h1
					style={{ color: 'red', display: 'inline-block' }}
					id='title'
					className='hehe'
					onClick={this.handleClick}
				>
					我是你爸爸{this.state.num}
				</h1>
			</div>
		);
	}
}
// const element = (
// 	<h1 style={{ color: 'red' }} id='title' className='hehe'>
//         我要
// 	</h1>
// );
// console.log(element);
console.log(<App name='张三' />);

ReactDOM.render(<App name='张三' />, document.getElementById('root'));
